﻿#include <iostream>

using namespace std;

class Prototype
{
public:
    virtual Prototype* Clone() = 0;
    virtual ~Prototype(){}
};

class ConcretePrototype :public Prototype
{
public:
    ConcretePrototype() = default;

    ConcretePrototype(const ConcretePrototype& cp)
    {
        cout <<  "Concrete Prototype copy"  << endl;
    }

    Prototype* Clone()
    {
        return new ConcretePrototype(*this);
    }
};

int main()
{
    Prototype* prototype = new ConcretePrototype();
    cout << prototype << endl;
    Prototype* prototype1 = prototype->Clone();
    cout << prototype1 << endl;
    Prototype* prototype2 = prototype->Clone();
    cout << prototype2 << endl;

    delete prototype;
    delete prototype1;
    delete prototype2;

    return 0;
}

